package com.ruoyi.iot.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iot.mapper.IotMonitorMapper;
import com.ruoyi.iot.domain.IotMonitor;
import com.ruoyi.iot.service.IIotMonitorService;

/**
 * 监控Service业务层处理
 * 
 * @author 陈江灿
 * @date 2025-02-14
 */
@Service
public class IotMonitorServiceImpl implements IIotMonitorService 
{
    @Autowired
    private IotMonitorMapper iotMonitorMapper;

    /**
     * 查询监控
     * 
     * @param monitorId 监控主键
     * @return 监控
     */
    @Override
    public IotMonitor selectIotMonitorByMonitorId(Long monitorId)
    {
        return iotMonitorMapper.selectIotMonitorByMonitorId(monitorId);
    }

    /**
     * 查询监控列表
     * 
     * @param iotMonitor 监控
     * @return 监控
     */
    @Override
    public List<IotMonitor> selectIotMonitorList(IotMonitor iotMonitor)
    {
        return iotMonitorMapper.selectIotMonitorList(iotMonitor);
    }

    /**
     * 新增监控
     * 
     * @param iotMonitor 监控
     * @return 结果
     */
    @Override
    public int insertIotMonitor(IotMonitor iotMonitor)
    {
        iotMonitor.setCreateTime(DateUtils.getNowDate());
        return iotMonitorMapper.insertIotMonitor(iotMonitor);
    }

    /**
     * 修改监控
     * 
     * @param iotMonitor 监控
     * @return 结果
     */
    @Override
    public int updateIotMonitor(IotMonitor iotMonitor)
    {
        iotMonitor.setUpdateTime(DateUtils.getNowDate());
        return iotMonitorMapper.updateIotMonitor(iotMonitor);
    }

    /**
     * 批量删除监控
     * 
     * @param monitorIds 需要删除的监控主键
     * @return 结果
     */
    @Override
    public int deleteIotMonitorByMonitorIds(Long[] monitorIds)
    {
        return iotMonitorMapper.deleteIotMonitorByMonitorIds(monitorIds);
    }

    /**
     * 删除监控信息
     * 
     * @param monitorId 监控主键
     * @return 结果
     */
    @Override
    public int deleteIotMonitorByMonitorId(Long monitorId)
    {
        return iotMonitorMapper.deleteIotMonitorByMonitorId(monitorId);
    }
}
